package com.example.designpattern.singleton;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

@Controller
public class Test {



    public static void main(String[] args) throws UnknownHostException {
        /*SingletonUseInnerClass instance = SingletonUseInnerClass.getInstance();
        SingletonUseInnerClass instance2 = SingletonUseInnerClass.getInstance();
        SingletonUseInnerClass.SingletonHolder
        System.out.println(instance==instance2);*/
        InetAddress byName = Inet4Address.getByName("www.baidu.com");
        System.out.println(byName);
    }

    @ResponseBody
    @PostMapping(value = "/test",headers = {"Host=localhost:8080"})
    public String f1(@RequestParam("username") String name,@RequestParam("password") String password){
        System.out.println(name+"\n"+password);
        return "result";
    }

    @GetMapping("/testForm")
    public String test(){
        return "test";
    }
}
